﻿
using IotContract.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IotClientService.Models.Hbc;
public class PlcReadBlock
{
    /// <summary>
    /// 地址类型
    /// </summary>
    public PlcMemoryType MemoryType { get; set; } = PlcMemoryType.D;
    /// <summary>
    /// 开始
    /// </summary>
    public int StartAddr { get; set; }
    /// <summary>
    /// 结束
    /// </summary>
    public int EndAddr { get; set; }

    public int ReadWordCount { get; set; }

    public bool ReadComplete { get; set; }

    public byte[] ReadBuffer { get; set; }

    public int DBBlock { get; set; }

    public bool CheckContainAddress(int address)
    {
        if (StartAddr <= address)
        {
            return EndAddr >= address;
        }

        return false;
    }
}
